package com.ll.beautymall.ui.quality.presenter;

import com.ll.beautymall.bean.ZeroData;
import com.ll.beautymall.ui.quality.model.OnGetQualityDataLisenter;
import com.ll.beautymall.ui.quality.model.QualityBiz;
import com.ll.beautymall.ui.quality.view.IQualityView;

import java.util.HashMap;

/**
 * Created by Administrator on 2016/10/26.
 */
public class QualityPresenter {
    private QualityBiz qualityBiz;
    private IQualityView qualityView;

    public QualityPresenter(IQualityView view) {
        qualityView = view;
        qualityBiz = new QualityBiz();
    }

    public void setQualityData(final boolean isMore, HashMap<String, String> parameters) {
        qualityBiz.getQualityData(parameters, new OnGetQualityDataLisenter() {
            @Override
            public void onSucced(ZeroData zeroData) {
                if (isMore) {
                    qualityView.addQualityData(zeroData);
                } else {
                    qualityView.setQualityData(zeroData);
                }
            }

            @Override
            public void onFailed(String errorMsg) {
                qualityView.showErrorMsg(errorMsg);
            }
        });
    }
}
